<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/article.css">
<header class="layout head padding-small">
    <a href="javascript:pageBack();" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">帮助中心</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>

<div id="search_area">
	<div id="sear_pos">
        <form method="get">
        	<input type="hidden" name="act" value="article" />
            <input type="hidden" name="op" value="article_class" />
            <input type="text" name="art_key" id="art_key" value="" placeholder="文章名称" />
            <input type="submit" id="sear_sub" value="搜索" />
        </form>
    </div>
</div>
<?php if(!empty($output['search_list']) && is_array($output['search_list'])){?>
<div class="search_res_tit">搜索结果</div>
<div class="search_res">
	<ul>
    	<?php foreach ($output['search_list'] as $k=>$v){?>
    	<li><a <?php if($v['article_url']!=''){?>target="_blank"<?php }?> href="<?php if($v['article_url']!='')echo $v['article_url'];else echo ncUrl(array('act'=>'article','article_id'=>$v['article_id']), 'article');?>"><?php echo $v['article_title'];?></a></li>
        <?php }?>
    </ul>
</div>
<?php }?>
	
<div class="article">
	<ul class="cat_one">
    	<?php if(!empty($output['list']) && is_array($output['list'])){?>
        <?php foreach ($output['list'] as $k=>$v){?>
    	<li>
        	<div class="cat_title cat_one_tit"><?php echo $v['ac_name']?></div>
            <?php if(!empty($v['sub_class']) && is_array($v['sub_class'])){?>
        	<ul class="cat_two">
				<?php foreach ($v['sub_class'] as $key=>$val){?>
            	<li>
                	<div class="cat_title cat_two_tit"><?php echo $val['ac_name'];?></div>
                    <ul class="article_list">
                    	<?php if(!empty($output['article_list']) && is_array($output['article_list'])){?>
                        <?php foreach($output['article_list'] as $article) {?>
                        
						<?php if($article['ac_id'] ==$val['ac_id'] ){?>
                        <li><a <?php if($article['article_url']!=''){?>target="_blank"<?php }?> href="<?php if($article['article_url']!='')echo $article['article_url'];else echo ncUrl(array('act'=>'article','article_id'=>$article['article_id']), 'article');?>"><?php echo $article['article_title'];?></a></li>
                        <?php }?>
                            
                        <?php }?>
        				<?php }?>
                    </ul>
                </li>
        		<?php } ?>
            </ul>
            <?php }else {?>
            	<?php if(!empty($output['article_list']) && is_array($output['article_list'])){?>
                <ul class="article_list no_top">
                    <?php foreach ($output['article_list'] as $article) {?>
                    
                    <?php if($article['ac_id'] ==$v['ac_id'] ){?>
                    <li><a <?php if($article['article_url']!=''){?>target="_blank"<?php }?> href="<?php if($article['article_url']!='')echo $article['article_url'];else echo ncUrl(array('act'=>'article','article_id'=>$article['article_id']), 'article');?>" class="lebioa"><?php echo $article['article_title'];?></a></li>
                    <?php  } ?>
                        
                    <?php  } ?>
                </ul>
                <?php  } ?>
         <?php  } ?>
        </li>
        <?php }?>
        <?php }?>
    </ul>
</div>

<script type="text/javascript">
$(function(){
	
	$('.cat_one_tit').click(function(){
		var parent = $(this).parent('li');
		if($(this).hasClass('cat_title_current')){
			if(parent.has('.cat_two')){
				$(this).removeClass('cat_title_current');
				parent.children('.cat_two').hide();
			}
			if(parent.has('.no_top')){
				parent.children('.no_top').hide();
			}
		}else{
			if(parent.has('.cat_two')){
				$(this).addClass('cat_title_current');
				parent.children('.cat_two').show();
			}
			if(parent.has('.no_top')){
				parent.children('.no_top').show();
			}
		}
	});
	
	$('.cat_two_tit').click(function(){
		var parent = $(this).parent('li');
		if($(this).hasClass('cat_title_current')){
			$(this).removeClass('cat_title_current');
			parent.find('.article_list').hide();
		}else{
			$(this).addClass('cat_title_current');
			parent.find('.article_list').show();
		}
	});
})
</script>

